const express = require("express")
const session = require("express-session")
const app = express()
app.use(
  session({
    cookie: { maxAge: 7 * 24 * 60 * 60 * 1000 },
    secret: "jian",
    resave: true,
    saveUninitialized: false,
  })
)

app.listen(3000, () => console.log("hello"))
require("./plugins/db")(app)
require("./plugins/nms")
app.use(express.json())
app.use(
  require("cors")({
    origin: [
      "http://localhost:8080",
      "http://localhost:8081",
      "http://localhost",
    ],
    credentials: true,
  })
)
app.use("/upload", express.static(`${__dirname}/upload`))
require("./routes/admin")(app)
require("./routes/userRouter")(app)
require("./routes/videoRouter")(app)
require("./routes/commentRouter")(app)
require("./routes/danmuRouter")(app)
